package voovanHello;

import org.voovan.network.aio.AioSocket;
import org.voovan.network.messagesplitter.LineMessageSplitter;

import java.io.IOException;
import java.util.Scanner;

/**
 * 我有故事，你有酒么？
 * JKhaled created by yunqisong@foxmail.com 2017/8/31
 * FOR :
 */
public class VClient {

    public VClient() {
        AioSocket socket = null;
        try {
            socket = new VAioSocket("127.0.0.1", 20131, Integer.MAX_VALUE);
            socket.filterChain().add(new VStringFilter());
            socket.messageSplitter(new VMessageSplitter());
            socket.handler(new VClientHandler());
            socket.syncStart();
            Scanner scanner = new Scanner(System.in);
            while (true) {
                socket.synchronouSend(scanner.nextLine());
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        VClient vClient = new VClient();
    }
}
